package eSn.BasicAdapter;
//TODO eSn.BasicAdapter.Interaction类未完成
/***
 * 用于与对象、应用程序和系统交互作用的过程
 * @author LeoYan
 */
public class Interaction {
	
	public static final Object IIf(boolean Expression, Object TruePart, Object FalsePart){
		if (Expression){
			return TruePart;
		}else{
			return FalsePart;
		}
	}
	
	public static final String InputBox(String Prompt, String Title, String Default){
		return "";
	}
	
	public static final VbMsgBoxResult MsgBox(String Prompt,VbMsgBoxStyle icon,VbMsgBoxStyle button,VbMsgBoxStyle Defbutton,String Title){
		return VbMsgBoxResult.vbOK;
	}
	public static final void MsgBox(Object Prompt){
		MsgBox(Prompt.toString(),VbMsgBoxStyle.vbNone,VbMsgBoxStyle.vbOKOnly,VbMsgBoxStyle.vbDefButton1,"MessageBox");
	}
	
	/***
	 * 以同步的方式调用一个外部程序
	 * @param command 调用的命令
	 * @return 程序返回值
	 * @throws Exception 异常
	 */
	public static final int Shell(String command) throws Exception{
		Runtime rt = Runtime.getRuntime();
		Process p = null;
		try{
			p = rt.exec(command);
			return p.exitValue();
		}catch(Exception e){
			throw e;
		}
		
	}
}
